package main

/**
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL
 */

type ListNode struct {
  Val  int
  Next *ListNode
}


func reverseList(head *ListNode) *ListNode {
	curr := head
	var prev *ListNode

	for {
		if curr == nil{
			break
		}

		nextTemp := curr.Next
		curr.Next = prev
		prev = curr
		curr = nextTemp

	}

	return prev
}
